﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Manage/TeacherMasterPage.master" AutoEventWireup="true" CodeFile="Papers.aspx.cs" Inherits="Manage_Papers" %>
<%@ Register Assembly="AspNetPager" Namespace="Wuqi.Webdiyer" TagPrefix="webdiyer" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
<script language="javascript" type="text/javascript" src="../My97DatePicker/WdatePicker.js"></script>
<style>
.mydiv{display:none;background-color:#000;Z-INDEX:100;POSITION: fixed;padding:5px;}
.inpNum{width:28px;text-align:right;border-top:0px;border-left:0px;border-right:0px;border-bottom-color:#666;border-bottom-width:1px;font-size:1em;padding-bottom:1px;color:Green;ime-mode:disabled;}
/*策略*/
.dgknow {font-size:1em;width:98%;border:0px; }
.grid tbody tr td .dgknow td{font-size:1em;}
ul{list-style:none;padding:0;margin:0;}
.tab{background:url(../images/sprites.png) left -52px repeat-x; overflow:hidden; padding-left:0px;height:26px;}
.tab ul li{float:left; margin-right:7px;margin-top:0px;}
.tab ul li a{text-decoration:none;background:url(../images/sprites.png) left -26px no-repeat;padding-left:5px; float:left; color:#666;}
.tab ul li a span{height:26px; line-height:26px; float:left; position:relative; right:-5px; padding-right:10px; background:url(../images/sprites.png) right -26px no-repeat; cursor:pointer;}
.tab ul li.current a{background-position:left top; color:#fff; font-weight:bold;}
.tab ul li.current a span{background-position:right top;}
.div-content-show{display:block;}
.div-content-hide{display:none;}
</style>



<script>
    $(function () {
        $("#dg tbody tr").hoverIntent(
            function () { $(this).children().css("background-color", "#F2F4F6"); },
            function () { $(this).children().css("background-color", "#FFFFFF"); }
        );
        //设置选择考生 选择策略 窗体居中
        var obj = $(".mydiv");
        var windowWidth = document.documentElement.clientWidth;
        var windowHeight = document.documentElement.clientHeight;
        $(obj).css({
            "width": windowWidth - 50,
            "height": windowHeight - 50
        });
        //新建试卷窗体
        $('#BtnAdd').click(function (e) {
            $('#Add-modal-content').modal({
                opacity: 55, zIndex: 10,
                onOpen: function (dialog) {
                    dialog.overlay.fadeIn('slow', function () {
                        dialog.data.hide();
                        dialog.container.fadeIn('fast', function () {
                            dialog.data.show(); //slideDown('slow');
                        });
                    });
                }
            });
            return false;
        });
        //删除试卷
        $("#BtnDel").click(function (e) {
            confirm("<%= Resources.labels.ConfirmDelete %>", function () {
                var chk = "";
                $("input[name=chk]").each(function () {
                    if ($(this).attr("checked")) {
                        chk += $(this).val() + ",";
                    }
                });
                if (chk != "") {
                    var array = chk.split(',');
                    for (var i = 0; i < array.length; i++) {
                        if (array[i] != "") {
                            var ss = delCurrPaper(chk);

                            if (ss) {
                                rowHide(chk);
                            }
                        }
                    }
                    $("#statusDel").html("&nbsp;<img src='../images/ok.png' border=0 style='vertical-align:middle;' /><%= Resources.labels.Del_ok%>").css("color", "#066606").show();
                    window.setTimeout(refresh, 2000);

                } else {
                    $("#statusDel").html("&nbsp;<img src='../images/erro.png' border=0 style='vertical-align:middle;' /><%= Resources.labels.Pleaseselectopts%>").css("color", "#FF0000").show();
                }
            });
        });
    });
    function refresh() {
        location.reload();
    }
</script>
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<table border="0"  class="grid" cellspacing="0" cellpadding="0" width="100%">
<thead><tr><th><%= Resources.labels.PaperList%></th></tr></thead>
<tr><td align=left> 

        <a href='#' id='BtnAdd' class="button"><%= Resources.labels.AddPaper%></a>
        <a href='#' id='BtnDel' class="button"><%= Resources.labels.Delete_Chk%></a>
        &nbsp;&nbsp;
        <%= Resources.labels.from%>:<asp:TextBox ID="starTime" onfocus="WdatePicker({isShowWeek:true,position:{top:'under'},dateFmt:'yyyy-MM-dd HH:mm:ss'})" width=100px runat="server" Text="" ></asp:TextBox>
        <%= Resources.labels.to%>:<asp:TextBox ID="endTime" onfocus="WdatePicker({isShowWeek:true,position:{top:'under'},dateFmt:'yyyy-MM-dd HH:mm:ss'})"  width=100px runat="server" Text="" ></asp:TextBox>
        <%= Resources.labels.SearchWord%>:<asp:TextBox ID="keywordTb"  width=140px  runat="server" Text="" ></asp:TextBox>
        <asp:Button ID="btnSearch" CssClass="button" runat="server" Text="查询" onclick="btnSearch_Click" />
    </td></tr>

<tr>
<td>
    <table id="dg" class="grid" cellspacing="0" cellpadding="0" width="100%">
        <thead>
            <tr>
                <th width=5%><%= Resources.labels.select%></th>
                <th ><%= Resources.labels.papaerName%></th>
                <th width=12%><%= Resources.labels.Department%></th>
                <th width=12%><%= Resources.labels.StarTime%></th>
                <th width=12%><%= Resources.labels.EndTime%></th>
                <th width=12%><%= Resources.labels.Status%></th>
                
            </tr>
        </thead>
        <tbody>
        <asp:Repeater ID="rp" runat="server" EnableViewState=false 
                onitemdatabound="rp_ItemDataBound">
        <ItemTemplate>
            <tr>
                <td><input id='chk<%# Eval("PaperID")%>' name="chk" <%# getDisabled(Eval("PaperID").ToString())%> type="checkbox" value='<%# Eval("PaperID")%>' /></td>
                <td>
                    <div style="font-size:1em;"><a href="paper.aspx?id=<%# Eval("PaperID")%>" target=_blank title="<%= Resources.labels.PreView%>"><%# Eval("PaperName")%></a></div>
                    <%--<%# DataBinder.Eval(Container.DataItem, "PaperName").ToString().Length > 5 ? DataBinder.Eval(Container.DataItem, "PaperName").ToString().Substring(0, 10) + "……" : DataBinder.Eval(Container.DataItem, "PaperName").ToString()%> --%>
                    <div style="width:90%;font-size:0.9em;color:#A3A3A3;margin-left:20px;margin-top:5px;">
                        <asp:Literal ID="litTj" runat="server"></asp:Literal>
                    </div>
                    <div style="width:90%;font-size:1em; color:#333;margin-left:20px;margin-top:5px;margin-bottom:5px;">
                     <a class="lit_button" href="javascript:void(0);" title="<%= Resources.labels.SetCurrPaper%>" onclick="setCurrPaper('<%# Eval("PaperID")%>',<%# Eval("DepartmentID")%>);return false;">
                     <img src="../images/set9x9.gif" />
                     </a>
                     &nbsp;&nbsp;
                     <a class="lit_button" href="javascript:void(0);" title="<%= Resources.labels.Edit%>" onclick="">
                     <img src="../images/edit9x9.gif" />
                     </a>
                     &nbsp;&nbsp;
                     <a class="lit_button" href="javascript:void(0);" title="" onclick="">
                     <img src="../images/tip9x9.gif" />
                     </a>
                     &nbsp;&nbsp;
                     <a class="lit_button" href="javascript:void(0);" title="" onclick="">
                     <img src="../images/delete9x9.gif" />
                     </a>

                     
                    </div>
                </td>
                <td><%# getdept(Eval("DepartmentID").ToString().Trim())%></td>
                <td><%# Eval("StarTime")%></td>
                <td><%# Eval("EndTime")%></td>
                <td><%# getStatus(Eval("IsCurrExam").ToString())%></td>
            </tr>
        </ItemTemplate>
        </asp:Repeater>
        </tbody>
    	<tfoot>
    	    <tr>
    	        <td align=left  colspan=6 >
    	            <webdiyer:aspnetpager id="AspNetPager1" runat="server" 
    	            EnableViewState="True"
    	            horizontalalign="Center" 
    	            PagingButtonSpacing="8px" 
                    showcustominfosection="Left" 
                    urlpaging="false" width="100%" 
                    ImagePath="~/images" 
                    NumericButtonType="Text" 
                    ButtonImageExtension="gif" 
                    ButtonImageNameExtension="n" 
                    DisabledButtonImageNameExtension="g" 
                    ShowNavigationToolTip="true" 
                    FirstPageText="<<" 
                    LastPageText=">>" NextPageText=">" PageSize="20" 
                    PrevPageText="<" SubmitButtonText="Go" 
                        onpagechanged="AspNetPager1_PageChanged"></webdiyer:aspnetpager>
    	        </td>

    	    </tr>
    	</tfoot>
    </table>
</td>

</tr>
</table>


<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr>
<td>
    <table class="grid" border="0" cellspacing="0" cellpadding="0" width="100%">
        <thead>
            <tr>
                <th><%= Resources.labels.count%></th>
            </tr>
        </thead>
        <tbody>
            <tr>
                <td><%= Resources.labels.total%> 
                    <asp:Label ID="Label1" runat="server" Text="0"></asp:Label> <%= Resources.labels.Paper%> </td>
            </tr>
        </tbody>
    	<tfoot>
    	    <tr>
    	        <th></th>
    	    </tr>
    	</tfoot>
    </table>
</td>
</tr>
</table>

<div id="Add-modal-content">
    <div class="modal-div"><%= Resources.labels.papaerName%>：<input id="examName" style="width:370px;" type="text" /></div>
    <div class="modal-div"><%= Resources.labels.descript%>：<asp:TextBox ID="examDesc" Height="44px" TextMode="MultiLine" Width="370px" runat="server"></asp:TextBox></div>

    <div class="modal-div"><%= Resources.labels.ExamTime%>：<input id="paperTime" style="width:100px;" type="text" maxlength="5" onkeypress="if(event.keyCode<48 || event.keyCode>57) event.returnValue = false;" onpaste="return false;" onafterpaste="return false;" /><%= Resources.labels.Minute%>(<%= Resources.labels.number%>)</div>
    <div class="modal-div" style="">类型：
    <input id="Radio1" name="paperType" value=1 checked=checked type="radio" /><label for="Radio1">题目相同顺序相同</label>
    <input id="Radio2" name="paperType" value=2 type="radio" /><label for="Radio2">题目相同乱序出题</label>
    <%--<input id="Radio3" name="paperType" value=0 type="radio" /><label for="Radio3">随机出题</label>--%>
    </div>
    <div class="modal-div"><%= Resources.labels.StarTime%>：
                            <input id="examStarTime" onfocus="WdatePicker({isShowWeek:true,position:{top:'under'},dateFmt:'yyyy-MM-dd HH:mm:ss'})" type="text" />
                           <%= Resources.labels.EndTime%>：
                           <input id="examEndTime" onfocus="WdatePicker({isShowWeek:true,position:{top:'under'},dateFmt:'yyyy-MM-dd HH:mm:ss'})" type="text" />
                           </div>
                       
    <div class="modal-div"><%= Resources.labels.Department%>：
    <select id="deptList" onchange="selectdept()">
        <option value="0">--<%= Resources.labels.select%><%= Resources.labels.Department%>--</option>
        <%for (int i = 0; i < DeptList.Count; i++) {%>
        <option value="<%=DeptList[i].DepartmentID.Trim() %>"><%=DeptList[i].DepartmentName.Trim()%></option>
        <%} %>
    </select>(<%= Resources.labels.isRequiredField%>)
    <%--<input id="Button1" type="button" value="选择考生" onclick="selectStudent()" />--%>
    <%--<input id="Button6" type="button" value="查看" onclick="ViewStudent()" />--%>
    <input id="HidStudenList" type="hidden" value="" />
    <div id="sectedstulist" style="display:none;"><%= Resources.labels.PleaseChkStudent%></div>
    </div>
    
    <div class="modal-div"><%= Resources.labels.Course%>：
    <select id="couList">
        <option value="0">--<%= Resources.labels.SelectCourse%>--</option>
        <%foreach(Exam.Core.Model.Course obj in CourseList){ %>
        <option value="<%=obj.Id.Trim() %>"><%=obj.Title.Trim() %></option>
        <%} %>
    </select>(<%= Resources.labels.isRequiredField%>)
    <input id="Button7" class="button" type="button" value="<%= Resources.labels.Strategy%>" onclick="selectTactics()" />
    <input id="Button8" class="button" type="button" value="<%= Resources.labels.view%>" onclick="ViewTactics()" />
    <input id="HidTactics" type="hidden" value="" /><!--记录题型知识点难度出题数量-->
    <input id="HidTypeList" type="hidden" value="" /><!--记录题型分值-->
    </div>
    
    <div class="modal-div"><%= Resources.labels.ReExam%>：<input id="AllowRe" name="AllowRe" type="checkbox" /><label for="AllowRe"><%= Resources.labels.allow%></label></div>
    
    <p>
    <input id="btnAddPaper" type="button" class="button" onclick="addNew()" value="<%= Resources.labels.add%>" />
    <input id="btnCanclePaper" type="button" class="button" value="<%= Resources.labels.cancel%>" onclick="CancleNew()" />
    <span id="status" style="display:none;"><img src="../images/loading16x16.gif" border=0 /><%= Resources.labels.PleaseWaiting%></span>
    </p>
</div>

<div id='confirm'>
	<div class='header'><span><%= Resources.labels.warning%></span></div>
	<div class='message'></div>
	<span id="statusDel" class="status" style="display:none;font-size:0.8em;padding-top:5px;">
    <img src="../images/loading16x16.gif" border=0 style="vertical-align:middle;" /><%= Resources.labels.PleaseWaiting%>
    </span>
	<div class='buttons'>
		<div id="statuscancle" class='no simplemodal-close'><%= Resources.labels.cancel%></div>
		<div id="statusyes" class='yes'><%= Resources.labels.btnok%></div>
		
	</div>
</div>


<DIV id="DivTacticsContainer" class="mydiv">
    <DIV style="OUTLINE-STYLE: none;OUTLINE-COLOR: invert;OUTLINE-WIDTH: 0px;WIDTH:100%;HEIGHT:100%;OVERFLOW:visible;background-color:#eee;">
    <DIV style="DISPLAY: block;padding:5px;" id=DIV4 >
    <div id="DivTactics"><img src="../images/loading16x16.gif" style="vertical-align:middle"/><%= Resources.labels.PleaseWaiting%></div>
    <div style="text-align:center;">
    <input id="Button10" class="button" type="button" value="<%= Resources.labels.count%>" onclick="TONGJI()" /> &nbsp;
    <input id="Button9" class="button" type="button" value="<%= Resources.labels.btnok%>" onclick="TacticsOK()" />
    <input id="Button3" class="button" type="button" value="<%= Resources.labels.btnclose%>" onclick="TacticsCancel()" />
    </div>
    </DIV>
    </DIV>
</DIV>

<script>
    //生成试卷
    function addNew() {
        if ($("#examName").val() == "") { alert("<%= Resources.labels.enterValidPaperName%>"); return false; }
        if ($("#paperTime").val() == "") { alert("<%= Resources.labels.enterValidPaperTime%>"); return false; }
        if ($(":radio[name='paperType'][checked]").length <= 0) { alert("<%= Resources.labels.enterValidPaperType%>"); return false; }
        //if ($("#").val() == "") { alert(""); return false; }
        //是否选定考生
        //是否已经出题

        var pname = $("#examName").val();
        var ptime = $("#paperTime").val();
        var ptype = $("#:radio[name='paperType'][checked]").val();
        var pdesc = $("#<%=examDesc.ClientID%>").val();
        var startime = $("#examStarTime").val();
        var endtime = $("#examEndTime").val();
        var students = $("#HidStudenList").val();
        var qtype = $("#HidTypeList").val();
        var tactics = $("#HidTactics").val();
        var course = $("#couList").val();
        var dept = $("#deptList").val();
        if (dept == "0") { alert("<%= Resources.labels.enterValidDept%>"); return false; }
        else {
            //if (students == "") { alert("<%= Resources.labels.StudentMustBeAdd%>"); return false; }
        }

        var AllowRe = "0";
        if ($("#AllowRe").attr("checked")) {//允许
            AllowRe = "1";
        }
        $.ajax({
            type: "POST",
            cache: false,
            url: "Service/addPaper.aspx",
            data: "pname=" + pname + "&ptime=" + ptime + "&ptype=" + ptype + "&pdesc=" + pdesc + "&startime=" + startime + "&endtime=" + endtime + "&students=" + students + "&qtype=" + qtype + "&tactics=" + tactics + "&course=" + course + "&dept=" + dept + "&AllowRe=" + AllowRe,
            //status
            beforeSend: function() {
                $("#status").show();
                $("#btnCanclePaper").attr('disabled', true);
                $("#btnAddPaper").attr('disabled', true);
            },
            success: function(msg) {
                $("#status").hide();
                $("#btnCanclePaper").attr('disabled', false);
                $("#btnAddPaper").attr('disabled', false);
                if (msg == "1") {
                    $("#status").html("&nbsp;<img src='../images/ok.png' border=0 style='vertical-align:middle;' /><%= Resources.labels.Add_ok%>").css("color", "#066606").show();
                    window.setTimeout(refresh, 1000);
                } else {
                    $("#status").html("&nbsp;<img src='../images/erro.png' border=0 style='vertical-align:middle;' /><%= Resources.labels.Add_Fail%>").css("color", "#066606").show();
                }
            },
            error: function(msg) {
                $("#status").hide();
                $("#btnCanclePaper").attr('disabled', false);
                $("#btnAddPaper").attr('disabled', false);
                $("#status").html("&nbsp;<img src='../images/erro.png' border=0 style='vertical-align:middle;' /><%= Resources.labels.Add_Err%>").css("color", "#066606").show();
            }
        });
    }
    //取消生成试卷
    function CancleNew() {
        $.modal.close();
    }
    //选择部门
    function selectdept() {
        var deptid = $("#deptList").val();
        if (deptid == "0") { alert("<%= Resources.labels.enterValidDept%>"); return false; }
        $.ajax({
            type: "get",
            cache: false,
            url: "Service/getdept4paper.aspx?deptid=" + deptid,
            success: function (msg) {
                if (msg == "") {
                    alert("<%= Resources.labels.StudentMustBeAdd%>");
                    $("#HidStudenList").val("");
                } else {
                    $("#HidStudenList").val(msg);
                }
            },
            error: function (msg) {
                //$("#DivStuList").html("添加失败！");
            }
        });
    }
    /**
    //选择考生
    function selectStudent() {
        var couid = $("#deptList").val();
        if (couid == "0") {
            alert("请先选择部门！"); return false;
        }
        $("#chkallstudent").attr("checked", false);
        var obj = $("#Div1");
        $.ajax({
            type: "get",
            cache: false,
            url: "Service/getStudent.aspx?deptid=" + couid,
            success: function(msg) {
                $("#DivStuList").html(msg);
            },
            error: function(msg) {
                $("#DivStuList").html("添加失败！");
            }
        });
        obj.fadeIn('fast', function() { });
        center(obj);
    }
    //确认选中考生
    function StudentOK() {
        var list = "";
        var sectedstulist = "";
        $("input[name=chkStu]:checked").each(function() {
            var val = $(this).val();
            list += val + ",";
            sectedstulist += $(this).parent().text() + ",";
        });
        $("#HidStudenList").val(list);
        $("#sectedstulist").html("您选择的考生：" + sectedstulist);
        var obj = $("#Div1");
        obj.fadeOut('fast', function() { });

    }
    */
    //取消生成策略
    function StudentCancel() {
        var obj = $("#Div1");
        obj.fadeOut('fast', function() { });
        return false;
    }

    //设置居中
    function center(obj) {
        var windowWidth = document.documentElement.clientWidth;
        var windowHeight = document.documentElement.clientHeight;
        var popupHeight = $(obj).height();
        var popupWidth = $(obj).width();
        $(obj).css({
            "position": "absolute",
            "top": (windowHeight - popupHeight) / 2 + $(document).scrollTop(),
            "left": (windowWidth - popupWidth) / 2
        });
    }
    //全选考生
    function ChkAll() {
        //chkStu
        $("input[name=chkStu]").each(function() {
            $(this).attr("checked", !this.checked);
        });
    }
    /*
    //查看考生
    function ViewStudent() {
        alert($("#sectedstulist").html());
    }*/
    //选择策略
    function selectTactics() {
        var couid = $("#couList").val();
        if (couid == "0") {
            alert("<%= Resources.labels.PleaseSelectCourse%>"); return false;
        }
        $("#DivTactics").html("<p><img src=\"../images/loading16x16.gif\" style=\"vertical-align:middle\"/> <%= Resources.labels.PleaseWaiting%><p><br>");
        var obj = $("#DivTacticsContainer");
        center(obj);
        $.ajax({
            type: "get",
            cache: false,
            url: "Service/getTactics.aspx?cid=" + couid,
            success: function(msg) {
                $("#DivTactics").html(msg);
                $(".tab li").click(function() {
                    $(".tab li").removeClass("current");
                    $(this).addClass("current");
                    var tmpId = "div-" + $(this).attr("id");
                    $(".div-content tbody div").removeClass().addClass("div-content-hide");
                    $("#" + tmpId).removeClass().addClass("div-content-show");

                });
            },
            error: function(msg) {
                $("#DivTactics").html("<%= Resources.labels.GetInfoFail%>");
            }
        });

        obj.fadeIn('fast', function() { });

    }
    //确定策略
    function TacticsOK() {
        var str = statistics();
        //if (!confirm(str))
        //    return;


        //获取所有的出题策略
        var tmp = "";
        $(".inpNum").each(function() {
            var id = $(this).attr("id"); //题型ID
            var value = $(this).val(); //题目数量
            if (value != "")
                tmp += id + "_" + value + ","//难度_知识点_题型_数量 
        });

        var score = "";
        $(".score").each(function() {
            var o = $(this);
            if (o.val() != "")
                score += o.attr("qtype") + "_" + o.val() + ","; //题型_分值
        });

        if (tmp != "")
            $("#HidTactics").val(tmp);
        if (score != "")
            $("#HidTypeList").val(score);
        //alert(tmp + "\r\n" + score);
        var obj = $("#DivTacticsContainer");
        obj.fadeOut('fast', function() { });
        return false;
    }
    //取消生成策略
    function TacticsCancel() {
        var obj = $("#DivTacticsContainer");
        obj.fadeOut('fast', function() { });
        return false;
    }

    //检查出题数目最大值
    function chkMax(o, max) {
        if (parseInt(o.value) > parseInt(max)) {
            alert("<%= Resources.labels.questionNumberBig%>"); o.value = "";
        }
    }
    //检查分值
    function chkScore(o) {
        if (isNaN(o.value)) execCommand('undo');
    }
    function TONGJI() {
        var str = statistics();
        alert(str);
        return false;
    }

    function ViewTactics() {
        TONGJI();
        var qtype = $("#HidTypeList").val();
        var tactics = $("#HidTactics").val();
        //alert(qtype + "\r\n\r\n" + tactics);
    }

    function statistics() {
        var str = "<%= Resources.labels.count%>\r\n\r\n";
        var total = 0; //总分
        //获取每个题型的分值
        $(".score").each(function() {
            var o = $(this);
            var score = 0; //该题型分值
            if (o.val() != "")
                score = parseInt(o.val());
            var typeid = o.attr("qtype"); //题型ID 
            var typename = o.parent().text();
            var Num = 0; //计算题目总数
            $(".inpNum").each(function() {
                var oo = $(this);
                if (oo.attr("qtype") == typeid) {
                    if (oo.val() != "")
                        Num = Num + parseInt(oo.val())
                }
            });
            var tmp = "<%= Resources.labels.questionScore%>";
            tmp = tmp.replace("{0}", score)
            str += typename + "：" + Num + "，"+tmp+" \r\n\r\n";
            total = total + Num * score;
        });
        str += "<%= Resources.labels.papertotal%>：" + total + "\r\n";
        return str;
    }
    function confirm(message, callback) {
        $('#confirm').modal({
            closeHTML: "<a href='#' title='Close' class='modal-close'><%= Resources.labels.btnclose%></a>",
            overlayId: 'confirm-overlay',
            containerId: 'confirm-container',
            onShow: function (dialog) {
                var modal = this;
                $('.message', dialog.data[0]).append(message);
                $('.yes', dialog.data[0]).click(function () {
                    if ($.isFunction(callback)) {
                        callback.apply();
                    }
                });
            }
        });
    }
    //设定当前试卷
    function setCurrPaper(id, deptid) {
        $("#statusyes").html("<%=Resources.labels.btnok %>");
        confirm("<%= Resources.labels.confirmSetCurrPaper%>", function () {
            $.ajax({
                type: "get",
                cache: false,
                url: "Service/setcurrpaper.aspx?id=" + id + "&deptid=" + deptid,
                beforeSend: function () {
                    $("#statusDel").html("&nbsp;<img src='../images/loading16x16.gif' border=0 style='vertical-align:middle;' /><%= Resources.labels.PleaseWaiting%>").show();
                },
                success: function (msg) {
                    if (msg == "ok") {
                        $("#statusDel").html("&nbsp;<img src='../images/ok.png' border=0 style='vertical-align:middle;' /><%= Resources.labels.Operate_OK%>").css("color", "#066606");
                        window.setTimeout(refresh, 2000);

                    }
                    else {
                        $("#statusDel").html("&nbsp;<img src='../images/erro.png' border=0 style='vertical-align:middle;' /><%= Resources.labels.Operate_Fail%>").css("color", "#FF0000");
                    }
                },
                error: function (msg) {
                    $("#statusDel").html("&nbsp;<img src='../images/erro.png' border=0 style='vertical-align:middle;' /><%= Resources.labels.Operate_Err%>").css("color", "#FF0000");
                }
            });
        });


//        if (confirm("<%= Resources.labels.confirmSetCurrPaper%>")) {
//            $.ajax({
//                type: "get",
//                cache: false,
//                url: "Service/setcurrpaper.aspx?id=" + id + "&deptid=" + deptid,
//                success: function (msg) {
//                    if (msg == "ok") {
//                        alert("<%= Resources.labels.Operate_OK%>"); window.location.href = window.location.href;
//                    }
//                    else {
//                        alert("<%= Resources.labels.Operate_Fail%>");
//                    }
//                },
//                error: function (msg) {
//                    alert("<%= Resources.labels.Operate_Err%>");
//                }
//            });
//            
//        }
    }
    function refresh() {
        location.reload();
    }
    function delCurrPaper(id) {
        var result = false;
        $.ajax({
            type: "POST", async: false,
            cache: false,
            url: "Service/delpaper.aspx",
            data: "id=" + id,
            beforeSend: function () {
                $("#statusDel").html("&nbsp;<img src='../images/loading16x16.gif' border=0 style='vertical-align:middle;' /><%= Resources.labels.PleaseWaiting%>").show();
            },
            success: function (msg) {
                if (msg == "1") { result = true; }
                else { result = false; }
            },
            error: function (msg) {
                result = false;
            }
        });
        return result;
    }

</script>


</asp:Content>






